package KK.Role
{
	import KK.Animation.MovieClip;
	import KK.Cache.CacheManager;
	
	import flash.display.BitmapData;
	
	public class Soldier extends MovieClip
	{
		
		static private var AUTO_INCREMENT:uint;
		static private function get AI():String{
			return String(AUTO_INCREMENT++);
		}
		
		////////////////////////////////////////////////
		static public const UP:String=AI;
		static public const DOWN:String=AI;
		static public const LEFT:String=AI;
		static public const RIGHT:String=AI;
		static public const DIE:String=AI;
		
		public function Soldier( )
		{
			//TODO: implement function
			var skin:BitmapData;
			skin=CacheManager.GetCache("soldier1").bitmapData;
			super(24, 32, skin, 6);
			init();
		}
		
		
		
		/**
		 * 死亡
		 */
		public function Die(): void
		{
			
			playAnimation(DIE);
		}
		
		/**
		 * 向下
		 */
		public function Down(): void
		{
			
			playAnimation(DOWN);
		}
		
		/**
		 * 左边
		 */
		public function Left(): void
		{
			
			playAnimation(LEFT);
		}
		
		/**
		 * 右边
		 */
		public function Right(): void
		{
			
			playAnimation(RIGHT);
		}
		
		/**
		 * 向上
		 */
		public function Up(): void
		{
			playAnimation(UP);
		}
		
		
		
		/**
		 * 初始化  
		 * 
		 */
		private function init():void{
			initImage();
		}
		
		
		/**
		 * 初始化形象  
		 * 
		 */
		protected function initImage():void{
			addAnimation(UP,[0,1,2]);
			addAnimation(RIGHT,[3,4,5]);
			addAnimation(DOWN,[6,7,8]);
			addAnimation(LEFT,[9,10,11]);
		}
	}
}